

<%@ page import="ratemymacclass.Course" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'course.label', default: 'Course')}" />
        <title><g:message code="Add a new class" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav" style="text-align:center">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="Home"/></a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="List of Classes" args="[entityName]" /></g:link></span>
            <span class="menuButton"><g:link controller="professor" class="list" action="list">List of Professors</g:link></span>
                    <span class="menuButton"><g:link controller="course" class="list" action="faq">FAQ</g:link></span>
                    <span class="menuButton"><g:link controller="course" class="list" action="showCourseSearch">Find a Professor/Course</g:link></span>

        </div>
        <div class="body">
            <h1><g:message code="Add a new class" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${courseInstance}">
            <div class="errors">
                <g:renderErrors bean="${courseInstance}" as="list" />
            </div>
            </g:hasErrors>
            <div class="intro" id="new prof">
            <p>Check our class directory <g:link class="list" action="list"><g:message code="Here" args="[entityName]" /></g:link> before adding a new course. </p>
            <p>Please check your spelling before submission. You can check course numbers and names <a href="http://www.macalester.edu/academics/">Here</a></p>
            <p>Thank you!</p>
            </div>
            <g:form action="save" >
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="title"><g:message code="course.title.label" default="Title" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: courseInstance, field: 'title', 'errors')}">
                                    <g:textField name="title" value="${courseInstance?.title}" />
                                </td>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="department"><g:message code="course.department.label" default="Department" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: courseInstance, field: 'department', 'errors')}">
                                    <g:textField name="department" value="${courseInstance?.department}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="courseNum"><g:message code="course.courseNum.label" default="Course Num" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: courseInstance, field: 'courseNum', 'errors')}">
                                    <g:textField name="courseNum" value="${fieldValue(bean: courseInstance, field: 'courseNum')}" />
                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:submitButton name="create" class="save" value="${message(code: 'Save Record', default: 'Save Record')}" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
